#pragma once

#include <gl/glut.h>

const static float PI = 3.14159265358979323;

struct Point3D
{
	float x,y,z;
};

class Object
{
protected:
	float size;
	float rotation;
	Point3D position;

	void setColorMaterial()
	{
		GLfloat mat_ambient[] = {0.0f, 0.5f, 1.0f, 1.0f};
		GLfloat mat_diffuse[] = {0.0f, 0.5f, 1.0f, 1.0f};
		GLfloat mat_specular[] = {0.0f, 0.5f, 1.0f, 1.0f};
		GLfloat mat_shininess[] = {10.0f};
		glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
		glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);
		glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
		glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);
	}

public:
	float getSize() { return size; }
	void setSize(float size) { this->size = size; }

	float getRotation() { return rotation; }
	void setRotation(float rotation) { this->rotation = rotation; }

	Point3D getPosition() { return position; }
	void setPosition(Point3D position) { this->position = position; }
	void setPosition(float x, float y, float z)
	{
		this->position.x = x;
		this->position.y = y;
		this->position.z = z;
	}

	virtual void draw()
	{
		glPushMatrix();
		glScaled(size,size,size);
		glTranslated(position.x + 0.5, position.y + 0.5, position.z + 0.5);
		glRotatef(rotation, 0, 1, 0);
		setColorMaterial();
		glutSolidCube(1);
		glPopMatrix();
	}

	virtual void update(float delta) {}
};
